/**
 * FileContentManager is a Java based file manager desktop application, it can
 * show, edit and manipulate the content of the files archived inside a zip.
 * 
 * Copyright (C) 2007
 * 
 * Created by Camila Sanchez [http://mimix.wordpress.com/], Rafael Naufal
 * [http://rnaufal.livejournal.com] and Rodrigo [rdomartins@gmail.com]
 * 
 * FileContentManager is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version.
 * 
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with FileContentManager; if not, write to the Free Software Foundation,
 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
 */
/*
 * Created on 22/05/2007 21:35:52
 */
package br.com.jteam.jfcm.model.factory;

import br.com.jteam.jfcm.model.File;
import br.com.jteam.jfcm.model.FileType;

/**
 * <p>
 * Implement&ccedil;&atilde;o de uma f&aacute;brica que produz arquivos de
 * determinado tipo.
 * 
 * @author Rafael Naufal <rafael.naufal@gmail.com>
 * @since 1.0
 * @version $Id$
 */
public class FileFactory
{
	/**
	 * <p>
	 * Construtor protected. Somente classes deste pacote e classes derivadas
	 * t�m acesso a este construtor.
	 * 
	 */
	protected FileFactory()
	{
		super();
	}

	/**
	 * <p>
	 * Cria uma inst&acirc;ncia de uma f&aacute;brica de arquivos, dependendo do
	 * tipo de arquivo especificado.
	 * 
	 * @param fileType -
	 *            tipo do arquivo, que pode ser JPG, PNG, GIF, TEXT ou ZIP.
	 * @return inst&acirc;ncia da f&aacute;brica de arquivos.
	 */
	public static FileFactory getInstance(FileType fileType)
	{
		switch (fileType) {
			case JPG:
				return new JpgFileFactory();
			case GIF:
				return new GifFileFactory();
			case TEXT:
				return new TextFileFactory();
			case ZIP:
				return new ZipFileFactory();
			case PNG:
				return new PngFileFactory();
			case JAVA:
				return new JavaFileFactory();
			case HTML:
				return new HtmlFileFactory();
			case XHTML:
				return new XhtmlFileFactory();
			case PROPERTIES:
				return new PropertiesFileFactory();
			case XML:
				return new XmlFileFactory();
			case SHELL_SCRIPT:
				return new ShellScriptFileFactory();
			case DEFAULT:
				return new FileFactory();
			default:
				return null;
		}
	}

	/**
	 * <p>
	 * Cria um arquivo padr&atilde;o como nome e caminho espec&icirc;ficos no
	 * disco.
	 * 
	 * @param name -
	 *            nome do arquivo.
	 * @param path -
	 *            caminho do arquivo no disco.
	 * @return Arquivo criado.
	 */
	public File createFile(String name, String path)
	{
		return new File(name, path);
	}
}
